import 'package:flutter/material.dart';
import 'package:flutter_demo/ui/pages/status/inherited/update/b1_page_widget.dart';
import 'package:flutter_demo/ui/pages/status/inherited/update/share_update_widget.dart';

class A1PageWidget extends StatefulWidget {
  const A1PageWidget({super.key});

  @override
  State<A1PageWidget> createState() => _A1PageWidgetState();
}

class _A1PageWidgetState extends State<A1PageWidget> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Center(
          child: Text("${ShareUpdateWidget.of(context).nickname}"),
        ),
        SizedBox(
          height: 20,
        ),
        ElevatedButton(
          onPressed: () {
            debugPrint(ShareUpdateWidget.of(context).nickname);
          },
          child: Text("A页面:获取B页面修改的值"),
        ),
        ElevatedButton(
          onPressed: () {
            Navigator.push(context, MaterialPageRoute(builder: (context) {
              return B1PageWidget();
            }));
          },
          child: Text("A页面:使用路由情况跳转B"),
        ),
      ],
    );
  }

  @override
  void didChangeDependencies() {
    print("数据更新！！！！！！");
    super.didChangeDependencies();
  }
}
